<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   Convolution Neural Network (CNN) 原理与实现  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/12090.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466454702: Accept with keywords: (title(0.333333333333):原理,社区,数盟, topn(0.3):社区,联系,数盟,深度学习,行业资讯,数据挖掘,原理,过程,图书,原作者,数据分析,结果,人工智能,职位,职业规划,python,基础架构,文章,可视化,数据,卷积,不变性,合作伙伴,资源,编程语言,部分,代码,课程,评论,行业).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    Convolution Neural Network (CNN) 原理与实现
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    Convolution Neural Network (CNN) 原理与实现 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,85] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/ai">
       人工智能
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/12090.html">
          Convolution Neural Network (CNN) 原理与实现
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          2,992 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/ai" rel="category tag">
          人工智能
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <p>
        作者：
        <a class="user_name" href="http://my.csdn.net/abcjennifer" target="_blank">
         Rachel-Zhang
        </a>
       </p>
       <p>
        本文结合Deep learning的一个应用，Convolution Neural Network 进行一些基本应用，参考Lecun的Document 0.1进行部分拓展，与结果展示（in python）。
       </p>
       <p>
        分为以下几部分：
       </p>
       <p>
        1. Convolution（卷积）
       </p>
       <p>
        2. Pooling（降采样过程）
       </p>
       <p>
        3. CNN结构
       </p>
       <p>
        4.  跑实验
       </p>
       <p>
        下面分别介绍。
       </p>
       <p>
        PS：本篇blog为ese机器学习短期班参考资料（20140516课程），本文只是简要讲最naive最simple的思想，重在实践部分，原理课上详述。
       </p>
       <div>
       </div>
       <div>
        <p>
         1. Convolution（卷积）
        </p>
        <p>
         类似于高斯卷积，对imagebatch中的所有image进行卷积。对于一张图，其所有feature map用一个filter卷成一张feature map。 如下面的代码，对一个imagebatch（含两张图）进行操作，每个图初始有3张feature map(R,G,B), 用两个9*9的filter进行卷积，结果是，每张图得到两个feature map。
        </p>
        <p>
         卷积操作由theano的conv.conv2d实现，这里我们用随机参数W，b。结果有点像edge detector是不是？
        </p>
        <p>
         Code: （详见注释）
        </p>
        <div class="dp-highlighter bg_python">
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="comment">
            # -*- coding: utf-8 -*-
           </span>
          </li>
          <li class="">
           <span class="comment">
            “””
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            Created on Sat May 10 18:55:26 2014
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            @author: rachel
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            Function: convolution option of two pictures with same size (width,height)
           </span>
          </li>
          <li class="">
           <span class="comment">
            input: 3 feature maps (3 channels &lt;RGB&gt; of a picture)
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            convolution: two 9*9 convolutional filters
           </span>
          </li>
          <li class="">
           <span class="comment">
            “””
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           theano.tensor.nnet
           <span class="keyword">
            import
           </span>
           conv
          </li>
          <li class="alt">
           <span class="keyword">
            import
           </span>
           theano.tensor as T
          </li>
          <li class="">
           <span class="keyword">
            import
           </span>
           numpy, theano
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
           rng = numpy.random.RandomState(
           <span class="number">
            23455
           </span>
           )
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # symbol variable
           </span>
          </li>
          <li class="">
           input = T.tensor4(name =
           <span class="string">
            ‘input’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            # initial weights
           </span>
          </li>
          <li class="alt">
           w_shape = (
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            9
           </span>
           ,
           <span class="number">
            9
           </span>
           )
           <span class="comment">
            #2 convolutional filters, 3 channels, filter shape: 9*9
           </span>
          </li>
          <li class="">
           w_bound = numpy.sqrt(
           <span class="number">
            3
           </span>
           *
           <span class="number">
            9
           </span>
           *
           <span class="number">
            9
           </span>
           )
          </li>
          <li class="alt">
           W = theano.shared(numpy.asarray(rng.uniform(low = –
           <span class="number">
            1.0
           </span>
           /w_bound, high =
           <span class="number">
            1.0
           </span>
           /w_bound,size = w_shape),
          </li>
          <li class="">
           dtype = input.dtype),name =
           <span class="string">
            ‘W’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           b_shape = (
           <span class="number">
            2
           </span>
           ,)
          </li>
          <li class="alt">
           b = theano.shared(numpy.asarray(rng.uniform(low = -.
           <span class="number">
            5
           </span>
           , high = .
           <span class="number">
            5
           </span>
           , size = b_shape),
          </li>
          <li class="">
           dtype = input.dtype),name =
           <span class="string">
            ‘b’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           conv_out = conv.conv2d(input,W)
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #T.TensorVariable.dimshuffle() can reshape or broadcast (add dimension)
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            #dimshuffle(self,*pattern)
           </span>
          </li>
          <li class="">
           <span class="comment">
            # &gt;&gt;&gt;b1 = b.dimshuffle(‘x’,0,’x’,’x’)
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            # &gt;&gt;&gt;b1.shape.eval()
           </span>
          </li>
          <li class="">
           <span class="comment">
            # array([1,2,1,1])
           </span>
          </li>
          <li class="alt">
           output = T.nnet.sigmoid(conv_out + b.dimshuffle(
           <span class="string">
            ‘x’
           </span>
           ,
           <span class="number">
            0
           </span>
           ,
           <span class="string">
            ‘x’
           </span>
           ,
           <span class="string">
            ‘x’
           </span>
           ))
          </li>
          <li class="">
           f = theano.function([input],output)
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            # demo
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            import
           </span>
           pylab
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           PIL
           <span class="keyword">
            import
           </span>
           Image
          </li>
          <li class="alt">
           <span class="comment">
            #minibatch_img = T.tensor4(name = ‘minibatch_img’)
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            #————-img1—————
           </span>
          </li>
          <li class="">
           img1 = Image.open(open(
           <span class="string">
            ‘//home//rachel//Documents//ZJU_Projects//DL//Dataset//rachel.jpg’
           </span>
           ))
          </li>
          <li class="alt">
           width1,height1 = img1.size
          </li>
          <li class="">
           img1 = numpy.asarray(img1, dtype =
           <span class="string">
            ‘float32’
           </span>
           )/
           <span class="number">
            256.
           </span>
           <span class="comment">
            # (height, width, 3)
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            # put image in 4D tensor of shape (1,3,height,width)
           </span>
          </li>
          <li class="alt">
           img1_rgb = img1.swapaxes(
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            2
           </span>
           ).swapaxes(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            2
           </span>
           ).reshape(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            3
           </span>
           ,height1,width1)
           <span class="comment">
            #(3,height,width)
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #————-img2—————
           </span>
          </li>
          <li class="alt">
           img2 = Image.open(open(
           <span class="string">
            ‘//home//rachel//Documents//ZJU_Projects//DL//Dataset//rachel1.jpg’
           </span>
           ))
          </li>
          <li class="">
           width2,height2 = img2.size
          </li>
          <li class="alt">
           img2 = numpy.asarray(img2,dtype =
           <span class="string">
            ‘float32’
           </span>
           )/
           <span class="number">
            256.
           </span>
          </li>
          <li class="">
           img2_rgb = img2.swapaxes(
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            2
           </span>
           ).swapaxes(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            2
           </span>
           ).reshape(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            3
           </span>
           ,height2,width2)
           <span class="comment">
            #(3,height,width)
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #minibatch_img = T.join(0,img1_rgb,img2_rgb)
           </span>
          </li>
          <li class="alt">
           minibatch_img = numpy.concatenate((img1_rgb,img2_rgb),axis =
           <span class="number">
            0
           </span>
           )
          </li>
          <li class="">
           filtered_img = f(minibatch_img)
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # plot original image and two convoluted results
           </span>
          </li>
          <li class="">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            1
           </span>
           );pylab.axis(
           <span class="string">
            ‘off’
           </span>
           );
          </li>
          <li class="alt">
           pylab.imshow(img1)
          </li>
          <li class="">
          </li>
          <li class="alt">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            4
           </span>
           );pylab.axis(
           <span class="string">
            ‘off’
           </span>
           );
          </li>
          <li class="">
           pylab.imshow(img2)
          </li>
          <li class="alt">
          </li>
          <li class="">
           pylab.gray()
          </li>
          <li class="alt">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            2
           </span>
           ); pylab.axis(
           <span class="string">
            “off”
           </span>
           )
          </li>
          <li class="">
           pylab.imshow(filtered_img[
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            0
           </span>
           ,:,:])
           <span class="comment">
            #0:minibatch_index; 0:1-st filter
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            3
           </span>
           ); pylab.axis(
           <span class="string">
            “off”
           </span>
           )
          </li>
          <li class="alt">
           pylab.imshow(filtered_img[
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            1
           </span>
           ,:,:])
           <span class="comment">
            #0:minibatch_index; 1:1-st filter
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            5
           </span>
           ); pylab.axis(
           <span class="string">
            “off”
           </span>
           )
          </li>
          <li class="">
           pylab.imshow(filtered_img[
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            0
           </span>
           ,:,:])
           <span class="comment">
            #0:minibatch_index; 0:1-st filter
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            6
           </span>
           ); pylab.axis(
           <span class="string">
            “off”
           </span>
           )
          </li>
          <li class="alt">
           pylab.imshow(filtered_img[
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            1
           </span>
           ,:,:])
           <span class="comment">
            #0:minibatch_index; 1:1-st filter
           </span>
          </li>
          <li class="">
           pylab.show()
          </li>
         </ol>
        </div>
        <p>
         <a href="http://dataunion.org/wp-content/uploads/2015/03/20140515202416843.png">
          <img src="http://dataunion.org/wp-content/uploads/2015/03/20140515202416843.png"/>
         </a>
        </p>
        <p>
         2. Pooling（降采样过程）
        </p>
        <p>
         最常用的Maxpooling. 解决了两个问题：
        </p>
        <p>
         1. 减少计算量
        </p>
        <p>
         2. 旋转不变性 （原因自己悟）
        </p>
        <p>
         PS：对于旋转不变性，回忆下SIFT，LBP：采用主方向；HOG：选择不同方向的模版
        </p>
        <p>
         Maxpooling的降采样过程会将feature map的长宽各减半。（下面结果图中没有体现出来，python自动给拉到一样大了，但实际上像素数是减半的）
        </p>
        <p>
         Code: （详见注释）
        </p>
        <div class="dp-highlighter bg_python">
         <ol class="dp-py" start="1">
          <li class="alt">
           <span class="comment">
            # -*- coding: utf-8 -*-
           </span>
          </li>
          <li class="">
           <span class="comment">
            “””
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            Created on Sat May 10 18:55:26 2014
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            @author: rachel
           </span>
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            Function: convolution option
           </span>
          </li>
          <li class="">
           <span class="comment">
            input: 3 feature maps (3 channels &lt;RGB&gt; of a picture)
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            convolution: two 9*9 convolutional filters
           </span>
          </li>
          <li class="">
           <span class="comment">
            “””
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           theano.tensor.nnet
           <span class="keyword">
            import
           </span>
           conv
          </li>
          <li class="alt">
           <span class="keyword">
            import
           </span>
           theano.tensor as T
          </li>
          <li class="">
           <span class="keyword">
            import
           </span>
           numpy, theano
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
           rng = numpy.random.RandomState(
           <span class="number">
            23455
           </span>
           )
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # symbol variable
           </span>
          </li>
          <li class="">
           input = T.tensor4(name =
           <span class="string">
            ‘input’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            # initial weights
           </span>
          </li>
          <li class="alt">
           w_shape = (
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            9
           </span>
           ,
           <span class="number">
            9
           </span>
           )
           <span class="comment">
            #2 convolutional filters, 3 channels, filter shape: 9*9
           </span>
          </li>
          <li class="">
           w_bound = numpy.sqrt(
           <span class="number">
            3
           </span>
           *
           <span class="number">
            9
           </span>
           *
           <span class="number">
            9
           </span>
           )
          </li>
          <li class="alt">
           W = theano.shared(numpy.asarray(rng.uniform(low = –
           <span class="number">
            1.0
           </span>
           /w_bound, high =
           <span class="number">
            1.0
           </span>
           /w_bound,size = w_shape),
          </li>
          <li class="">
           dtype = input.dtype),name =
           <span class="string">
            ‘W’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           b_shape = (
           <span class="number">
            2
           </span>
           ,)
          </li>
          <li class="alt">
           b = theano.shared(numpy.asarray(rng.uniform(low = -.
           <span class="number">
            5
           </span>
           , high = .
           <span class="number">
            5
           </span>
           , size = b_shape),
          </li>
          <li class="">
           dtype = input.dtype),name =
           <span class="string">
            ‘b’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           conv_out = conv.conv2d(input,W)
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #T.TensorVariable.dimshuffle() can reshape or broadcast (add dimension)
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            #dimshuffle(self,*pattern)
           </span>
          </li>
          <li class="">
           <span class="comment">
            # &gt;&gt;&gt;b1 = b.dimshuffle(‘x’,0,’x’,’x’)
           </span>
          </li>
          <li class="alt">
           <span class="comment">
            # &gt;&gt;&gt;b1.shape.eval()
           </span>
          </li>
          <li class="">
           <span class="comment">
            # array([1,2,1,1])
           </span>
          </li>
          <li class="alt">
           output = T.nnet.sigmoid(conv_out + b.dimshuffle(
           <span class="string">
            ‘x’
           </span>
           ,
           <span class="number">
            0
           </span>
           ,
           <span class="string">
            ‘x’
           </span>
           ,
           <span class="string">
            ‘x’
           </span>
           ))
          </li>
          <li class="">
           f = theano.function([input],output)
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            # demo
           </span>
          </li>
          <li class="alt">
           <span class="keyword">
            import
           </span>
           pylab
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           PIL
           <span class="keyword">
            import
           </span>
           Image
          </li>
          <li class="alt">
           <span class="keyword">
            from
           </span>
           matplotlib.pyplot
           <span class="keyword">
            import
           </span>
           *
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            #open random image
           </span>
          </li>
          <li class="">
           img = Image.open(open(
           <span class="string">
            ‘//home//rachel//Documents//ZJU_Projects//DL//Dataset//rachel.jpg’
           </span>
           ))
          </li>
          <li class="alt">
           width,height = img.size
          </li>
          <li class="">
           img = numpy.asarray(img, dtype =
           <span class="string">
            ‘float32’
           </span>
           )/
           <span class="number">
            256.
           </span>
           <span class="comment">
            # (height, width, 3)
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # put image in 4D tensor of shape (1,3,height,width)
           </span>
          </li>
          <li class="">
           img_rgb = img.swapaxes(
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            2
           </span>
           ).swapaxes(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            2
           </span>
           )
           <span class="comment">
            #(3,height,width)
           </span>
          </li>
          <li class="alt">
           minibatch_img = img_rgb.reshape(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            3
           </span>
           ,height,width)
          </li>
          <li class="">
           filtered_img = f(minibatch_img)
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # plot original image and two convoluted results
           </span>
          </li>
          <li class="">
           pylab.figure(
           <span class="number">
            1
           </span>
           )
          </li>
          <li class="alt">
           pylab.subplot(
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            1
           </span>
           );pylab.axis(
           <span class="string">
            ‘off’
           </span>
           );
          </li>
          <li class="">
           pylab.imshow(img)
          </li>
          <li class="alt">
           title(
           <span class="string">
            ‘origin image’
           </span>
           )
          </li>
          <li class="">
          </li>
          <li class="alt">
           pylab.gray()
          </li>
          <li class="">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            2
           </span>
           ); pylab.axis(
           <span class="string">
            “off”
           </span>
           )
          </li>
          <li class="alt">
           pylab.imshow(filtered_img[
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            0
           </span>
           ,:,:])
           <span class="comment">
            #0:minibatch_index; 0:1-st filter
           </span>
          </li>
          <li class="">
           title(
           <span class="string">
            ‘convolution 1’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           pylab.subplot(
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            3
           </span>
           ,
           <span class="number">
            3
           </span>
           ); pylab.axis(
           <span class="string">
            “off”
           </span>
           )
          </li>
          <li class="alt">
           pylab.imshow(filtered_img[
           <span class="number">
            0
           </span>
           ,
           <span class="number">
            1
           </span>
           ,:,:])
           <span class="comment">
            #0:minibatch_index; 1:1-st filter
           </span>
          </li>
          <li class="">
           title(
           <span class="string">
            ‘convolution 2’
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           <span class="comment">
            #pylab.show()
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # maxpooling
           </span>
          </li>
          <li class="">
           <span class="keyword">
            from
           </span>
           theano.tensor.signal
           <span class="keyword">
            import
           </span>
           downsample
          </li>
          <li class="alt">
          </li>
          <li class="">
           input = T.tensor4(
           <span class="string">
            ‘input’
           </span>
           )
          </li>
          <li class="alt">
           maxpool_shape = (
           <span class="number">
            2
           </span>
           ,
           <span class="number">
            2
           </span>
           )
          </li>
          <li class="">
           pooled_img = downsample.max_pool_2d(input,maxpool_shape,ignore_border =
           <span class="special">
            False
           </span>
           )
          </li>
          <li class="alt">
          </li>
          <li class="">
           maxpool = theano.function(inputs = [input],
          </li>
          <li class="alt">
           outputs = [pooled_img])
          </li>
          <li class="">
          </li>
          <li class="alt">
           pooled_res = numpy.squeeze(maxpool(filtered_img))
          </li>
          <li class="">
           <span class="comment">
            #pylab.figure(2)
           </span>
          </li>
          <li class="alt">
           pylab.subplot(
           <span class="number">
            235
           </span>
           );pylab.axis(
           <span class="string">
            ‘off’
           </span>
           );
          </li>
          <li class="">
           pylab.imshow(pooled_res[
           <span class="number">
            0
           </span>
           ,:,:])
          </li>
          <li class="alt">
           title(
           <span class="string">
            ‘down sampled 1’
           </span>
           )
          </li>
          <li class="">
          </li>
          <li class="alt">
           pylab.subplot(
           <span class="number">
            236
           </span>
           );pylab.axis(
           <span class="string">
            ‘off’
           </span>
           );
          </li>
          <li class="">
           pylab.imshow(pooled_res[
           <span class="number">
            1
           </span>
           ,:,:])
          </li>
          <li class="alt">
           title(
           <span class="string">
            ‘down sampled 2’
           </span>
           )
          </li>
          <li class="">
          </li>
          <li class="alt">
           pylab.show()
          </li>
         </ol>
        </div>
        <p>
         <a href="http://dataunion.org/wp-content/uploads/2015/03/122.png">
          <img src="http://dataunion.org/wp-content/uploads/2015/03/122.png"/>
         </a>
         <br/>
         3. CNN结构
        </p>
        <p>
         想必大家随便google下CNN的图都滥大街了，这里拖出来那时候学CNN的时候一张图，自认为陪上讲解的话画得还易懂（&lt;!–囧–&gt;）
        </p>
        <p>
         废话不多说了，直接上Lenet结构图：（从下往上顺着箭头看，最下面为底层original input）
        </p>
        <p>
        </p>
        <p>
         4. CNN代码
        </p>
       </div>
       <div>
        去
        <a href="http://download.csdn.net/detail/abcjennifer/7352983" target="_blank">
         资源
        </a>
        里下载吧，我放上去了喔~（in python）
       </div>
       <div>
       </div>
       <div>
        这里贴少部分代码，仅表示建模的NN：
        <p>
        </p>
        <div class="dp-highlighter bg_python">
         <div class="bar">
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           rng = numpy.random.RandomState(
           <span class="number">
            23455
           </span>
           )
          </li>
          <li class="">
          </li>
          <li class="alt">
           <span class="comment">
            # transfrom x from (batchsize, 28*28) to (batchsize,feature,28,28))
           </span>
          </li>
          <li class="">
           <span class="comment">
            # I_shape = (28,28),F_shape = (5,5),
           </span>
          </li>
          <li class="alt">
           N_filters_0 =
           <span class="number">
            20
           </span>
          </li>
          <li class="">
           D_features_0=
           <span class="number">
            1
           </span>
          </li>
          <li class="alt">
           layer0_input = x.reshape((batch_size,D_features_0,
           <span class="number">
            28
           </span>
           ,
           <span class="number">
            28
           </span>
           ))
          </li>
          <li class="">
           layer0 = LeNetConvPoolLayer(rng, input = layer0_input, filter_shape = (N_filters_0,D_features_0,
           <span class="number">
            5
           </span>
           ,
           <span class="number">
            5
           </span>
           ),
          </li>
          <li class="alt">
           image_shape = (batch_size,
           <span class="number">
            1
           </span>
           ,
           <span class="number">
            28
           </span>
           ,
           <span class="number">
            28
           </span>
           ))
          </li>
          <li class="">
           <span class="comment">
            #layer0.output: (batch_size, N_filters_0, (28-5+1)/2, (28-5+1)/2) -&gt; 20*20*12*12
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           N_filters_1 =
           <span class="number">
            50
           </span>
          </li>
          <li class="alt">
           D_features_1 = N_filters_0
          </li>
          <li class="">
           layer1 = LeNetConvPoolLayer(rng,input = layer0.output, filter_shape = (N_filters_1,D_features_1,
           <span class="number">
            5
           </span>
           ,
           <span class="number">
            5
           </span>
           ),
          </li>
          <li class="alt">
           image_shape = (batch_size,N_filters_0,
           <span class="number">
            12
           </span>
           ,
           <span class="number">
            12
           </span>
           ))
          </li>
          <li class="">
           <span class="comment">
            # layer1.output: (20,50,4,4)
           </span>
          </li>
          <li class="alt">
          </li>
          <li class="">
           layer2_input = layer1.output.flatten(
           <span class="number">
            2
           </span>
           )
           <span class="comment">
            # (20,50,4,4)-&gt;(20,(50*4*4))
           </span>
          </li>
          <li class="alt">
           layer2 = HiddenLayer(rng,layer2_input,n_in =
           <span class="number">
            50
           </span>
           *
           <span class="number">
            4
           </span>
           *
           <span class="number">
            4
           </span>
           ,n_out =
           <span class="number">
            500
           </span>
           , activation = T.tanh)
          </li>
          <li class="">
          </li>
          <li class="alt">
           layer3 = LogisticRegression(input = layer2.output, n_in =
           <span class="number">
            500
           </span>
           , n_out =
           <span class="number">
            10
           </span>
           )
          </li>
         </ol>
        </div>
        <p>
         layer0, layer1 ：分别是卷积+降采样
        </p>
        <p>
         layer2+layer3：组成一个MLP（ANN）
        </p>
        <p>
         训练模型：
        </p>
        <div class="dp-highlighter bg_python">
         <div class="bar">
         </div>
         <ol class="dp-py" start="1">
          <li class="alt">
           cost = layer3.negative_log_likelihood(y)
          </li>
          <li class="">
           params = layer3.params + layer2.params + layer1.params + layer0.params
          </li>
          <li class="alt">
           gparams = T.grad(cost,params)
          </li>
          <li class="">
          </li>
          <li class="alt">
           updates = []
          </li>
          <li class="">
           <span class="keyword">
            for
           </span>
           par,gpar
           <span class="keyword">
            in
           </span>
           zip(params,gparams):
          </li>
          <li class="alt">
           updates.append((par, par – learning_rate * gpar))
          </li>
          <li class="">
          </li>
          <li class="alt">
           train_model = theano.function(inputs = [minibatch_index],
          </li>
          <li class="">
           outputs = [cost],
          </li>
          <li class="alt">
           updates = updates,
          </li>
          <li class="">
           givens = {x: train_set_x[minibatch_index * batch_size : (minibatch_index+
           <span class="number">
            1
           </span>
           ) * batch_size],
          </li>
          <li class="alt">
           y: train_set_y[minibatch_index * batch_size : (minibatch_index+
           <span class="number">
            1
           </span>
           ) * batch_size]})
          </li>
         </ol>
        </div>
        <p>
         根据cost（最上层MLP的输出NLL），对所有层的parameters进行训练
        </p>
        <p>
         剩下的具体见代码和注释。
        </p>
        <p>
         PS：数据为MNIST所有数据
        </p>
        <p>
        </p>
       </div>
       <div>
       </div>
       <div>
        final result：
        <br/>
        Optimization complete. Best validation score of 0.990000 % obtained at iteration 122500, with test performance 0.950000 %
       </div>
       <p>
        文章出处：
        <a href="http://blog.csdn.net/abcjennifer/article/details/25912675">
         http://blog.csdn.net/abcjennifer/article/details/25912675
        </a>
       </p>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/11692.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/03/341-300x212.png"/>
        </a>
        <a class="link" href="http://dataunion.org/11692.html" rel="bookmark" title="技术向：一文读懂卷积神经网络CNN">
         技术向：一文读懂卷积神经网络CNN
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/10383.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/02/t01712dcdbcec324210-300x200.png"/>
        </a>
        <a class="link" href="http://dataunion.org/10383.html" rel="bookmark" title="让冰冷的机器看懂这个多彩的世界">
         让冰冷的机器看懂这个多彩的世界
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/6444.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/01/Rnq2Ar-300x99.png"/>
        </a>
        <a class="link" href="http://dataunion.org/6444.html" rel="bookmark" title="Image classification的几个常见CNN model">
         Image classification的几个常见CNN model
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/5395.html">
         <img src="http://dataunion.org/wp-content/uploads/2014/12/10233353-308b9c9421e14dba8ab3b57ddff6c378-300x211.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/5395.html" rel="bookmark" title="深度学习：CNN的反向求导及练习">
         深度学习：CNN的反向求导及练习
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F12090.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/12090.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/12090.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>